use bigdecimal::BigDecimal;
use num_traits::ToPrimitive;
use std::str::FromStr;

pub fn new_birthday_probability(n: u32) -> f64 {
    let mut a = BigDecimal::from_str("1").unwrap();
    let mut b = BigDecimal::from_str("1").unwrap();
    for i in 0..n {
        a *= 365 - i;
        b *= 365;
    }
    (BigDecimal::from_str("1").unwrap() - a / b).with_prec(5).to_f64().unwrap()
}
